#!/bin/sh
#
# @name Traxxas stampede vxl 2wd
#
# @url https://traxxas.com/products/models/electric/stampede-vxl-tsm
#
# @type Rover
# @class Rover
#
# @output MAIN2 steering
# @output MAIN4 throttle
#
# @maintainer Marco Zorzi
#
# @board px4_fmu-v2 exclude
#

sh /etc/init.d/rc.rover_defaults

if [ $AUTOCNF = yes ]
then
	param set BAT_N_CELLS 7

	param set EKF2_GBIAS_INIT 0.01
	param set EKF2_ANGERR_INIT 0.01
	param set EKF2_MAG_TYPE 1

	param set FW_AIRSPD_MIN 0
	param set FW_AIRSPD_TRIM 1
	param set FW_AIRSPD_MAX 3

	param set GND_WR_P 2
	param set GND_WR_I 0.9674
	param set GND_WR_IMAX 0.1
	param set GND_WR_D 1.2
	param set GND_SP_CTRL_MODE 1
	param set GND_L1_DIST 10
	param set GND_THR_IDLE 0
	param set GND_THR_CRUISE 0
	param set GND_THR_MAX 0.5
	param set GND_THR_MIN 0
	param set GND_SPEED_P 0.25
	param set GND_SPEED_I 0.001
	param set GND_SPEED_D 3
	param set GND_SPEED_IMAX 0.125
	param set GND_SPEED_THR_SC 1

	param set MIS_LTRMIN_ALT 0.01
	param set MIS_TAKEOFF_ALT 0.01

	param set NAV_ACC_RAD 0.5

	# Provide ESC a constant 1500 us pulse
	param set PWM_DISARMED 1500
	param set PWM_MAX 2000
	param set PWM_MIN 1000
fi

# Configure this as rover
set MAV_TYPE 10

# Set mixer
set MIXER stampede

set PWM_MAIN_REV2 1
